package cn.ustb.dao;

import cn.ustb.entity.CriterStudent;
import cn.ustb.entity.StudentBasicInformation;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @author yuyan
 */
public interface StudentBasicInfoDao {
    /**
     * fetch data by studentId
     * @param  parseLong studentId
     * @return StudentBasicInformation
     */
    @Select("select *from studentBasicInformation where studentId = #{parseLong}")
    StudentBasicInformation get(long parseLong);
    /**
     * fetch data by sbi
     * @param  sbi sbi
     */
    @Update("update studentBasicInformation set studentName = #{studentName},gender = #{gender}, grade = #{grade}, className = #{className}, academy = #{academy}, profession = #{profession}, campus = #{campus}, phone = #{phone}, homeAddress = #{homeAddress} where studentId = #{studentId}")
    void update(StudentBasicInformation sbi);
    /**
     * fetch data by Student
     * @param  cs Student
     * @return List<StudentBasicInformation>
     */
    @Select("select * from studentBasicInformation where academy like #{academy} and Profession like #{profession} and ClassName like #{className} and StudentName like #{studentName} and StudentId like #{studentId}")
    List<StudentBasicInformation> getForListWithCriterStudent(CriterStudent cs);
}